package com.zws.cucumber.util.colorfullog.table;

import org.slf4j.event.Level;

import static com.zws.cucumber.util.colorfullog.table.ZwsPrefixRender.EmptyPrefixRender;

public class ZwsTablePrinterConfig implements Cloneable {

    public static ZwsTablePrinterConfig newConfig() {
        return new ZwsTablePrinterConfig();
    }

    private Level logLevel = Level.DEBUG;
    private ZwsPrefixRender prefixRender = EmptyPrefixRender;
    private boolean printRowSeparator = false;

    private ZwsTablePrinterConfig() {}

    protected ZwsTablePrinterConfig clone0() {
        try {
            return (ZwsTablePrinterConfig) clone();
        } catch (CloneNotSupportedException ex) {
            throw new RuntimeException(ex);
        }
    }

    public Level logLevel() {
        return logLevel;
    }

    public ZwsPrefixRender prefixRender() {
        return prefixRender;
    }

    public boolean printRowSeparator() {
        return printRowSeparator;
    }

    public ZwsTablePrinterConfig withLogLevel(Level logLevel) {
        ZwsTablePrinterConfig config = clone0();
        config.logLevel = logLevel;
        return config;
    }

    public ZwsTablePrinterConfig withPrintingRowSeparator(boolean printRowSeparator) {
        ZwsTablePrinterConfig config = clone0();
        config.printRowSeparator = printRowSeparator;
        return config;
    }

    public ZwsTablePrinterConfig withPrefixRender(ZwsPrefixRender prefixRender) {
        ZwsTablePrinterConfig config = clone0();
        config.prefixRender = prefixRender;
        return config;
    }

}
